<template>
  <div class="component-addcontract">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>甲方中国移动
          </p>
        </div>

        <div class="topright" @click="$router.go(-1)">
          <el-button type="info">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe606;</span>返回
          </el-button>
        </div>
      </div>
      <!-- 中间部分 -->
      <div class="component-main">
        <div class="component-main-left">
          <div class="box1">
            <span class="iconfont">&#xe67e;</span>
            <span>基本信息</span>
            <div class="arrow"></div>
          </div>
        </div>

        <!-- 表单部分 -->
        <div class="component-main-right">
          <div class="box">
            <el-form
              :model="ruleForm"
              :rules="rules"
              ref="ruleForm"
              label-width="100px"
              class="demo-ruleForm"
              :inline="true"
            >
              <el-form-item label="框架合同编号：" prop="userTruename" label-width="150px">
                <el-input v-model="ruleForm.userTruename" style="width: 300px;" placeholder="请输入框架合同编号" clearable></el-input>
              </el-form-item>
              <el-form-item label="内部合同编号：" prop="userOrg" label-width="150px">
                <el-input v-model="ruleForm.userOrg" style="width: 300px;"placeholder="请输入内部合同编号" clearable></el-input>
              </el-form-item>
              <el-form-item label="虚拟合同编号：" prop="fictitious" label-width="150px">
                <el-input style="width: 300px;" v-model="ruleForm.fictitious=ruleForm.userTruename+'-001'" placeholder="请输入虚拟合同编号" disabled></el-input>
              </el-form-item>
              <el-form-item label="合同名称：" prop="userName" label-width="150px">
                <el-input style="width: 300px;" v-model="ruleForm.userName" placeholder="请输入合同名称" clearable></el-input>
              </el-form-item>
              <el-form-item label="甲方：" prop="role" label-width="150px">
                <el-select v-model="ruleForm.role" placeholder="全部" style="width: 300px;" clearable>
                  <el-option
                    v-for="(item, index) in items"
                    :key="index"
                    :value="item.orgId"
                    :label="item.orgName"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="乙方：" prop="role1" label-width="150px">
                <el-select v-model="ruleForm.role1" placeholder="全部" style="width: 300px;" clearable>
                  <el-option
                    v-for="(item, index) in itemss"
                    :key="index"
                    :value="item.orgId"
                    :label="item.orgName"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="合同金额(万元)：" prop="userMoney" label-width="150px">
                <!--<el-input type="number" v-model="ruleForm.userMoney" placeholder="合同金额(万元)" clearable></el-input>-->
                <el-input-number style="width: 300px;" v-model="ruleForm.userMoney" placeholder="请输入合同金额(万元)" controls-position="right" :min="0" clearable></el-input-number>
              </el-form-item>
              <el-form-item
                label="降点数："
                prop="count"
                label-width="150px"
                sstyle="margin-left: 8px;"
              >
                <el-input-number style="width: 300px;" v-model="ruleForm.count" placeholder="请输入将点数" controls-position="right" :min="0" :max="1" :step="0.1" clearable></el-input-number>
              </el-form-item>
              <!-- 时间 -->
              <el-form-item prop="date1" label="签订时间：" label-width="150px" required>
                <el-date-picker
                  style="width: 300px;"
                  v-model="ruleForm.date1"
                  type="date"
                  placeholder="选择日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="timestamp"
                  default-time="00:00:00"
                ></el-date-picker>
              </el-form-item>
              <el-form-item label="开工时间：" prop="date3" label-width="150px" required>
                <el-date-picker
                  style="width: 300px;"
                  v-model="ruleForm.date3"
                  type="date"
                  placeholder="选择日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="timestamp"
                  default-time="00:00:00"
                ></el-date-picker>
              </el-form-item>
              <el-form-item label="完工时间：" prop="date2" label-width="150px" required>
                <el-date-picker
                  v-model="ruleForm.date2"
                  style="width: 300px;"
                  type="date"
                  placeholder="选择日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="timestamp"
                  default-time="00:00:00"
                ></el-date-picker>
              </el-form-item>
              <!-- 上传文件 -->
              <el-form-item label="合同附件：" label-width="150px">
                <el-upload
                  ref="upload"
                  class="upload-demo"
                  action="/api/web/proContract/ProContractFile"
                  :headers="myheader"
                  :file-list="fileList"
                  :auto-upload="true"
                  :data="FileObject"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :before-remove="beforeRemove"
                  :before-upload="beforeAvatarUpload"
                  :on-exceed="handleExceed"
                  :limit="1"
                  :on-success="handChange"
                  :multiple="true"
                >
                  <el-button
                    size="small"
                    type="primary"
                    style=" width: 300px;
                    height: 40px;
                    "
                  >选择上传文件</el-button>
                </el-upload>
              </el-form-item>
              <!--accept=".jpg, .jpeg, .png, .pdf, .dwg, .xls, .xlsx, .doc, .docx, .JPG, .JPEG, .PNG, .PDF, .DWG, .XLS, .XLSX, .DOC, .DOCX, .zip, .rar"-->
              <div style="font-size: 12px;color: #ccc;margin-top: -10px;margin-left: 120px;margin-bottom: 12px;">文件大小不能超过10M</div>

              <el-form-item
                style="margin-left:65px;"
                prop="type"
                label-width="150px"
              >
                <div class="check-btn" style="width: 700px;margin-left: -100px;">
                  <span style="margin-right: 10px;">合同价款与支付：</span>
                  <el-checkbox v-model="checkboxSelect[0]" @click="checkboxSelect[0] = !checkboxSelect[0];">预付款</el-checkbox>
                  <el-checkbox v-model="checkboxSelect[1]" @click="checkboxSelect[1] = !checkboxSelect[1]">进度款</el-checkbox>
                  <el-checkbox v-model="checkboxSelect[2]" @click="checkboxSelect[2] = !checkboxSelect[2]">初验款</el-checkbox>
                  <el-checkbox v-model="checkboxSelect[3]" @click="checkboxSelect[3] = !checkboxSelect[3]">终验款</el-checkbox>
                  <!--<el-checkbox v-model="checkboxSelect[4]" @click="checkboxSelect[4] = !checkboxSelect[4]">结算款</el-checkbox>-->
                  <!--<el-checkbox v-model="checkboxSelect[4]" @click="checkboxSelect[4] = !checkboxSelect[4]">考核款</el-checkbox>-->
                </div>
              </el-form-item>

              <el-form-item v-if="checkboxSelect[0]">
                <div style="width: 600px;margin-left: -60px;">
                  <span class="labelText">预付款提醒设置：</span>
                  <span class="one">订单合同确认之日起</span><el-input-number v-model="ruleForm.input1" style="width: 100px;" :controls="false" :min="1" clearable></el-input-number>
                  <span class="two">日内</span>
                  <span class="three" @click="getDocName('ContractRemindDoc_1')">+ 需要资料</span>
                </div>
              </el-form-item>
              <el-form-item
                style="width:600px;"
                v-if="checkboxSelect[1]"
              >
                <div style="width: 600px;margin-left: 15px;">
                  <span class="labelText">进度款提醒设置： </span>
                  <el-input
                    style="text-align:center;width: 316px;background: #F2F2F2;"
                    disabled
                    placeholder="选择付款条件"
                    v-model="ruleForm.partySource"
                    @click.native="condition1=true;"
                  ></el-input>
                  <span class="three" @click="getDocName('ContractRemindDoc_2')">+ 需要资料</span>
                </div>
              </el-form-item>
              <el-form-item
                style="width:600px;"
                v-if="checkboxSelect[2]"
              >
                <div style="width: 600px;margin-left: 15px;">
                  <span class="labelText">初验款提醒设置：</span>
                  <el-input
                    style="text-align:center;width: 316px;background: #F2F2F2;"
                    disabled
                    placeholder="选择付款条件"
                    v-model="ruleForm.input2"
                    @click.native="condition2=true;"
                  ></el-input>
                  <span class="three" @click="getDocName('ContractRemindDoc_3')">+ 需要资料</span>
                </div>
              </el-form-item>
              <el-form-item
                style="width:600px;"
                v-if="checkboxSelect[3]"
              >
                <div style="width: 600px;margin-left: 15px;">
                  <span class="labelText">终验款提醒设置：</span>
                  <el-input
                    style="text-align:center;width: 316px;background: #F2F2F2;"
                    disabled
                    placeholder="选择付款条件"
                    v-model="ruleForm.input3"
                    @click.native="condition3=true;"
                  ></el-input>
                  <span class="three" @click="getDocName('ContractRemindDoc_4')">+ 需要资料</span>
                </div>
              </el-form-item>
              <el-form-item style="margin-left: 100px;">
                <el-button type="primary" @click="submitForm('ruleForm')" style="width:180px">提交</el-button>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </div>
    </div>
    <!--需要资料弹框-->
    <div class="component-model">
      <el-dialog title="需要资料" :visible.sync="alert1" width="800px">
        <el-button type="primary" style="margin-bottom: 20px;" @click="addMater=true;addDatas=''">+新增</el-button>
        <div>
          <el-checkbox-group v-model="checkListAlert1">
            <el-checkbox v-for="(item,index) in needDatas" :key="index" :label="item.constId">{{item.constName}}</el-checkbox>
          </el-checkbox-group>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="alert1 = false">取消</el-button>
          <el-button @click="selectData">确定</el-button>
        </span>
      </el-dialog>
    </div>
    <!--添加资料弹框-->
    <div class="component-model">
      <el-dialog title="添加资料" :visible.sync="addMater" width="800px">
        <div>
         需要资料：<el-input style="width:300px;" placeholder="请输入需要资料" v-model="addDatas"></el-input>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="addMater = false">取消</el-button>
          <el-button @click="addNeedMater">确定</el-button>
        </span>
      </el-dialog>
    </div>
    <!--进度款选择条件-->
    <div class="component-model">
      <el-dialog title="选择付款条件" :visible.sync="condition1" width="800px">
        <el-radio v-model="radio" label="1">分数考核</el-radio>
        <el-radio v-model="radio" label="2">完工项目达到相应比例</el-radio>
        <div v-if="radio==1" style="margin-top: 20px;">
          分数:
          <span class="one">甲方考核分数</span>
          <input
            type="text"
            class="main-input"
            style="text-align:center;"
            v-model="ruleForm.partyScore1"
          >
        </div>
        <div v-if="radio==2" style="margin-top: 20px;">
          完工项目:
          <span class="one">完工项目累计金额 > </span>
          <input
            type="text"
            class="main-input"
            style="text-align:center;"
            v-model="ruleForm.partyScore2"
          >
          <span class="two">%</span>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="condition1 = false">取消</el-button>
          <el-button @click="conditionF1">确定</el-button>
        </span>
      </el-dialog>
    </div>
    <!--初验款-->
    <div class="component-model">
      <el-dialog title="初验款条件" :visible.sync="condition2" width="800px">
        <el-radio v-model="radios" label="1">完工项目达到相应比例</el-radio>
        <div style="margin-top: 20px;">
          完工项目:
          <span class="one">完工项目累计金额 > </span>
          <input
            type="text"
            class="main-input"
            style="text-align:center;"
            v-model="ruleForm.input4"
          >
          <span class="two">%</span>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="condition2 = false">取消</el-button>
          <el-button @click="conditionF2">确定</el-button>
        </span>
      </el-dialog>
    </div>
    <!--终验款-->
    <div class="component-model">
      <el-dialog title="选择终验款条件" :visible.sync="condition3" width="800px">
        <el-radio v-model="radios" label="1">竣工项目达到相应比例</el-radio>
        <div style="margin-top: 20px;">
          竣工项目:
          <span class="one">竣工项目累计金额 > </span>
          <input
            type="text"
            class="main-input"
            style="text-align:center;"
            v-model="ruleForm.input5"
          >
          <span class="two">%</span>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="condition3 = false">取消</el-button>
          <el-button @click="conditionF3">确定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  import ElButton from "../../../node_modules/element-ui/packages/button/src/button";
  import ElInput from "../../../node_modules/element-ui/packages/input/src/input";
  import ElInputNumber from "../../../node_modules/element-ui/packages/input-number/src/input-number";
export default {
  components: {
    ElInputNumber,
    ElInput,
    ElButton},
  name: "addFra",
  data() {
    return {
      alert1:false,
      checkListAlert1:[],
      addMater:false,
      addDatas:'',
      condition1:false,
      condition2:false,
      condition3:false,
      radio:'1',
      radios:'1',
      // 获取token
      myheader: { token: localStorage.getItem("token") },
      // 获取的甲方乙方数据
      items: [],
      itemss: [],
      // 上传文件
      fileList: [],
      fileCode: {},
      FileObject: { bizType: "contract", parentId: this.$route.params.conId },
      checkboxSelect:[false,false,false,false,false],
      flag: 0,
      // 表单提交
      ruleForm: {
        count: "",
        userName: "",
        userOrg: "",
        userMoney: "",
        userTruename: "",
        role: "",
        role1: "",
        date1: "",
        date2: "",
        date3: "",
        type: [],
        info: [],
        input1: "",
        input2: "",
        input3: "",
        input4: "",
        input5: "",
        fictitious:'',//虚拟
        partySource:'',//选择付款条件
        partyScore1:'',//选择进度款分数
        partyScore2:'',//选择进度款分数
      },
      needDatas:[],//需要资料列表
      insertDatas:'',//得到是哪一个资料
      payType:'',//请款类型/1预付款，2-进度款，3-初验款，4-终验款
      // 表单验证
      rules: {
        date1: [{ required: true, message: "请选择签订日期", trigger: "blur" }],
        date3: [{ required: true, message: "请选择开工日期", trigger: "blur" }],
        date2: [{ required: true, message: "请选择完工日期", trigger: "blur" }],
        role: [{ required: true, message: "请选择甲方", trigger: "change" }],
        role1: [{ required: true, message: "请选择乙方", trigger: "change" }],
        select3: [{ required: true, message: "请输入合同类型", trigger: "blur" },
            {
            min: 1,
            max: 100,
            message: "长度在 1 到 100 个字符",
            trigger: "blur"
          }
        ],
        userTruename: [
          { required: true, message: "请输入框架合同编号", trigger: "blur" },
          { min: 1, max: 30, message: "长度在 1 到 30 个字符", trigger: "blur" }
        ],
        userOrg: [
          { required: true, message: "请输入内部合同编号", trigger: "blur" },
          { min: 1, max: 30, message: "长度在 1 到 30 个字符", trigger: "blur" }
        ],
        userName: [
          { required: true, message: "请输入合同名称", trigger: "blur" },
          {
            min: 1,
            max: 100,
            message: "长度在 1 到 100 个字符",
            trigger: "blur"
          }
        ],
        userMoney: [
          { required: true, message: "请输入合同金额", trigger: "blur" }
        ],
        count: [
          { required: true, message: "请输入降点数0~1", trigger: "blur" }
        ],
        fictitious:[{required: true, message: "请输入虚拟合同编号", trigger: "blur" },{ min: 1, max: 30, message: "长度在 1 到 30 个字符", trigger: "blur" }]
      }
    };
  },
  created() {
    // 调用获取甲方乙方的值
    this.getId();
  },
  methods: {
    //所需资料查询
    getDocName(val){
      let types = '';
      let conStage = '';
      if(this.payType==1 || val=='ContractRemindDoc_1'){
         types='ContractRemindDoc_1';
         conStage = '1'
      }
      if(this.payType==2 || val=='ContractRemindDoc_2'){
        types='ContractRemindDoc_2'
        conStage = '2'
      }
      if(this.payType==3 || val=='ContractRemindDoc_3'){
        types='ContractRemindDoc_3'
        conStage = '3'
      }
      if(this.payType==4 || val=='ContractRemindDoc_4'){
        types='ContractRemindDoc_4'
        conStage = '4'
      }
      let that = this;
      let params = {
        conId:that.$route.params.conId,
        conStage:conStage,//1-预付款阶段，2-进度款阶段，3-初验阶段，4-终验阶段
        docTypeCode:val||that.insertDatas||types
      };
      let suCb = res => {
        that.alert1=true;
        that.addMater=false;//添加资料弹框
        that.insertDatas = val||types;
        that.needDatas = res.data.data;
        let id = [];
        for(let i=0;i<res.data.data.length;i++){
            let ids = res.data.data[i].constId;
          id.push(ids)
        }
//        that.checkListAlert1 = id
      };
      let erCb = res => {
        console.log(res);
      };
      let req = {
        url: "/api/web/proContract/getCDocName",
        methods: "post",
        data: params,
        success: suCb,
        error: erCb
      };
      that.$https(req);
    },
    //新增所需资料
    addNeedMater(){
      let that = this;
      if(that.insertDatas=='ContractRemindDoc_1'){
        that.payType = '1';
      }
      if(that.insertDatas=='ContractRemindDoc_2'){
        that.payType = '2';
      }
      if(that.insertDatas=='ContractRemindDoc_3'){
        that.payType = '3';
      }
      if(that.insertDatas=='ContractRemindDoc_4'){
        that.payType = '4';
      }
      let params = {
        docType:that.insertDatas,//资料类型编码-ContractRemindDoc_1预付款，ContractRemindDoc_2进度款，ContractRemindDoc_3初验款，ContractRemindDoc_4终验款
        docName:that.addDatas,//资料名称
        payType:that.payType//请款类型/1预付款，2-进度款，3-初验款，4-终验款
      };
      let suCb = res => {
        that.getDocName();
      };
      let erCb = res => {
        console.log(res);
      };
      let req = {
        url: "/api/web/proContract/addDoc",
        methods: "post",
        data: params,
        success: suCb,
        error: erCb
      };
      that.$https(req);
    },
    //选择所需资料
    selectData(){
      let that = this;
      let params = {
        conId:that.$route.params.conId,
        conStage:that.payType,
        docId:that.checkListAlert1
      };
      let suCb = res => {
        that.alert1=false;
        that.$message({
          message: '选择成功',
          type: 'success',
          duration:500
        });
      };
      let erCb = res => {
        console.log(res);
      };
      let req = {
        url: "/api/web/proContract/addProContractPayDoc",
        methods: "post",
        data: params,
        success: suCb,
        error: erCb
      };
      that.$https(req);
    },
    //选择条件
    conditionF1(){
      if(this.radio==1){
        this.ruleForm.partyScore2=''
        if(isNaN(this.ruleForm.partyScore1) || this.ruleForm.partyScore1>100 || this.ruleForm.partyScore1<1){
          this.$erMsg("考核分数应在1~100")
          return false;
        }
        this.ruleForm.partySource='甲方分数考核：'+this.ruleForm.partyScore1+'分';
      }else{
        this.ruleForm.partyScore1=''
        if(isNaN(this.ruleForm.partyScore2) || this.ruleForm.partyScore2>100 || this.ruleForm.partyScore2<1){
          this.$erMsg("完工项目达到比例应在1~100")
          return false;
        }
        this.ruleForm.partySource='完工项目累计金额大于：'+this.ruleForm.partyScore2+'%';
      }
      this.condition1 = false;
    },
    conditionF2(){
      if(isNaN(this.ruleForm.input4) || this.ruleForm.input4>100 || this.ruleForm.input4<1){
        this.$erMsg("完工项目累计金额应在1~100")
        return false;
      }
      this.ruleForm.input2 = '完工项目累计金额大于：'+this.ruleForm.input4+'%';
      this.condition2 = false
    },
    conditionF3(){
      if(isNaN(this.ruleForm.input5) || this.ruleForm.input5>100 || this.ruleForm.input5<1){
        this.$erMsg("竣工项目累计金额应在1~100")
        return false;
      }
      this.ruleForm.input3 = '竣工项目累计金额大于：'+this.ruleForm.input5+'%';
      this.condition3 = false
    },
    // 上传文件
    handleRemove(file, fileList) {
      console.log(file, fileList);
      if(file.status == "success"){
        let params = {
          fileUrl: this.fileCode.fileUrl,
          parentId: this.$route.params.conId
        };
        let suCb = res => {
          this.fileList = [];
        };
        let req = {
          url: "/api/web/sysFile/deleteFile",
          methods: "post",
          data: params,
          success: suCb,
        };
        this.$https(req);
      }else{
        this.fileList = [];
      }
    },
    handlePreview(file) {
      console.log(file);
    },
    // 文件限制
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 1 个文件，本次选择了 ${
          files.length
        } 个文件，共选择了 ${files.length + fileList.length} 个文件`
      );
    },
    beforeRemove(file, fileList) {
//      return this.$confirm(`确定移除 ${file.name}？`);
    },
    beforeAvatarUpload(file) {
      const isLt2M = file.size / 1024 / 1024 < 10;
      if (!isLt2M) {
        this.$message.error('上传文件大小不能超过 10MB!');
      }
      return isLt2M;
    },
    // 上传成功
    handChange(res, file, fileList) {
      /*this.fileCode = fileList[0].response;
      this.fileList = fileList*/
      if (res.flag == "0") {
        this.$msg("请选择自定义文件类型上传！");
        this.fileList = [];
      } else if (res.flag == "1") {
        this.fileCode = fileList[0].response;
        this.fileList = fileList
      }
    },
    // 传过来的甲方乙方的值
    getId() {
      //  甲方
      this.items = this.$route.params.list1;
      // 乙方
      let that = this;
      let suCb = res => {
        // 得到乙方的值
        console.log(res);
        console.log(res.data.data);
        //  把甲方的数据传过去
        that.itemss = res.data.data;
      };
      let erCb = res => {
        console.log(res);
      };
      let params = {};
      let req = {
        // 请求乙方接口
        url: "/api/web/proContract/getDependParty",
        methods: "post",
        data: params,
        success: suCb,
        error: erCb
      };
      that.$https(req);
    },
    //本地存储
    clickMe(index) {
      this.flag = index;
      localStorage.setItem("flags", index);
    },
    // 提交表单
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
       if (valid) {
           if(this.ruleForm.date3>=this.ruleForm.date1 && this.ruleForm.date3<=this.ruleForm.date2){
             if(this.fileList.length>0){
               let that = this;
               let suCb = res => {
                 that.info = res.data.list;
                 this.$router.push({ name: "contractList" });
                 that.$msg("提交成功！");
               };
               let erCb = res => {
                 //   that.$msg("请先上传文件，再次提交");
               };
               let params = {
                 proContract: {
                   conId:that.$route.params.conId,//合同id
                   conOuterno: that.ruleForm.userTruename,//合同外部编号
                   conInnerno: that.ruleForm.userOrg,//合同内部编号
                   virtualNo:that.ruleForm.fictitious,//虚拟合同编号
                   conName: that.ruleForm.userName,//合同名称
                   conPartya: that.ruleForm.role,//甲方id
                   conPartyb: that.ruleForm.role1,//乙方公司id
                   conMoney: that.ruleForm.userMoney+"",//合同金额
                   conDroppoint: that.ruleForm.count+"",//降点数量
                   signDate: that.ruleForm.date1 + "",//签订时间
                   startDate: that.ruleForm.date3 + "",//开工时间
                   finishDate: that.ruleForm.date2 + "",//完工时间（暂定yyyy-mm-dd）
                   prepayFlag: that.checkboxSelect[0]==true?'1':'0',//是否预付提醒（0-不开启提醒，1-有提醒）
                   processFlag: that.checkboxSelect[1]==true?'1':'0',//是否进度提醒（0-不开启提醒，1-有提醒）
                   preAcceptFlag: that.checkboxSelect[2]==true?'1':'0',//是否初验款提醒（0-不提醒，1-提醒）
                   finalAcceptFlag:that.checkboxSelect[3]==true?'1':'0',//是否终验款提醒（0-不提醒，1-提醒）
                   conType: "1",//合同类型（1-框架合同、2-框架内虚拟合同、3-框架内子合同、4-单向合同5-外包合同）
                 },
                 prepayType: "Days",//预付款条件类型（Days-天数）
                 prepayValue: that.ruleForm.input1+"",//进度款条件值
                 processType: that.radio==1?'Score':'FinishedRate',//进度款条件类型（Score-分数考核，FinishedRate-完工比例）
                 processValue: that.radio==1?that.ruleForm.partyScore1:that.ruleForm.partyScore2,//进度款条件值
                 preAcceptType: "FinishedRate",//初验款条件类型（Score-分数考核，FinishedRate-完工比例）
                 preAcceptValue: that.ruleForm.input4,//初验款条件值
                 finalAcceptType: "FinishedRate",//终验款条件类型（Score-分数考核，FinishedRate-完工比例）
                 finalAcceptValue: that.ruleForm.input5//终验款条件值
               }
               let req = {
                 url: "/api/web/proContract/addContract",
                 methods: "post",
                 data: params,
                 success: suCb,
                 error: erCb
               };
               that.$https(req);
             }else{
               this.$erMsg('请先上传文件')
             }
           }else{
             this.$erMsg('开工时间应大于签订时间且小于完工时间')
           }


        } else {
          this.$erMsg("请按红色字的提示进行修改完善")
          return false;
        }
      })
    }
  }
};
</script>
<style scoped>
.component-main {
  width: 1150px;
  /* height: 1400px; */
  margin: 0 auto;
  margin-top: 49px;
  background-color: #fff;
  border: 1px solid #e4e4e4;
  border-top: none;
}
.component-main-left {
  width: 180px;
  height: 1352px;

  border: 1px solid #e4e4e4;
  padding-top: 50px;
  float: left;
  border-top: none;
}
.box1 {
  position: relative;
  width: 175px;
  height: 50px;
  text-align: left;
  line-height: 50px;
  background-color: #9ea7b4;
  color: #fff;
  padding-left: 5px;
}
.box1 .arrow {
  position: absolute;
  width: 0;
  height: 0;
  top: -40px;
  left: 180px;
  border-width: 25px 0 25px 25px;
  border-style: solid;
  border-color: transparent transparent transparent #9ea7b4; /*透明 透明 透明 灰*/
  margin: 40px auto;
}

/* 表单部分 */

.component-main-right {
  height: 1251px;
  float: left;
  width: 918px;
  margin: 0 auto;
  border-top: none;
  padding-top: 150px;
  border-bottom: 1px solid #e4e4e4;
  border-right: 1px solid #e4e4e4;
}

.box {
  width: 700px;
  margin: 0 auto;
}
.box .el-button--primary {
  color: #fff;
  background-color: #1abc9c;
  border-color: #1abc9c;
}
.box .el-form-item {
  width: 450px;
}

.el-form-item .el-form-item__label {
  width: 110px;
}

.el-form-item__content {
  margin-left: -103px;
}

.one {
  display: inline-block;
  width: 164px;
  height: 38px;
  line-height: 38px;
  background-color: #f2f2f2;
  border: 1px solid #e4e4e4;
}

.main-input {
  width: 90px;
  height: 40px;
  border: 1px solid #e4e4e4;
  margin-left: -4px;
  border-left: none;
}
.labelText{
  display: inline-block;
  width: 150px;
  text-align: right;
}
.two {
  display: inline-block;
  width: 50px;
  height: 38px;
  line-height: 38px;
  background-color: #f2f2f2;
  border: 1px solid #e4e4e4;
  border-left: none;
  margin-left: -4px;
}
.three{
  border:1px solid #1abc9c;
  padding: 11px 10px;
  color: #1abc9c;
  margin-left: 5px;
  cursor: pointer;
}
.el-checkbox{
  margin-bottom: 10px;
}
</style>
